<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="System.Drawing"%>

<%@ Import Namespace="System.Web.UI.DataVisualization.Charting"%>
<%@ Import Namespace="C3.Proto.Core.Model"%>
<asp:Content ID="indexTitle" ContentPlaceHolderID="TitleContent" runat="server">
    
</asp:Content>

<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">
    
    <h2>Statewide Report</h2>
    <a href="/Home">Back</a> <br />
    <a href="/Home/StateExcel">Export to Excel</a>
    <h4>Monthly Inspection Count</h4>
    GC Team:  <%= ((StateResults)ViewData["StateResults"]).GCCount%> inspections recorded from 
    <%= ((StateResults)ViewData["StateResults"]).GCProjects%> projects.<br /><br />
    OFPC Team:  <%= ((StateResults)ViewData["StateResults"]).OFPCCount%> inspections recorded from 
    <%= ((StateResults)ViewData["StateResults"]).OFPCProjects%> projects.<br /><br />
    ROCIP Team:  <%= ((StateResults)ViewData["StateResults"]).ROCIPCount%> inspections recorded from 
    <%= ((StateResults)ViewData["StateResults"]).ROCIPProjects%> projects.<br /><br />
    
    <h4>Combined Defecient Condition Categories</h4>
    <table cellpadding="5" cellspacing="5" style="border-collapse:collapse" border="1">
        <tr>
            <td>Statewide Deficiency Category</td>
            <td>ROCIP Team</td>
            <td>OFPC Team</td>
            <td>ROCIP Team</td>
        </tr>
    <%
        foreach (var c in ((StateResults)ViewData["StateResults"]).CategoryDeficiencies)
        {%>
        <tr>
            <td><%=c.Category %></td>
            <td><%=c.GC %>%</td>
            <td><%=c.OFPC %>%</td>
            <td><%=c.ROCIP %>%</td>
        </tr>
           
        <%}%>
        
    </table>
    <br />
<% var Chart1 = new System.Web.UI.DataVisualization.Charting.Chart
                      {
                          Width = 750,
                          Height = 296,
                          RenderType = RenderType.ImageTag,
                          ImageLocation = "..\\..\\TempImages\\ChartPic_#SEQ(200,30)",
                          Palette = ChartColorPalette.BrightPastel
                      };

   var t = new Title("Statewide Deficiency Category", Docking.Top, new System.Drawing.Font("Trebuchet MS", 9, System.Drawing.FontStyle.Bold), System.Drawing.Color.FromArgb(26, 59, 105));
    Chart1.Titles.Add(t);
    Chart1.ChartAreas.Add("ChartArea1");

    // Enable X axis labels automatic fitting
    Chart1.ChartAreas["ChartArea1"].AxisX.IsLabelAutoFit = true;
    Chart1.ChartAreas["ChartArea1"].AxisX.TextOrientation = TextOrientation.Rotated90;
    // Set X axis automatic fitting style
    Chart1.ChartAreas["ChartArea1"].AxisX.LabelAutoFitStyle =
        LabelAutoFitStyles.DecreaseFont | LabelAutoFitStyles.IncreaseFont | LabelAutoFitStyles.WordWrap;
    // create a couple of series
    Chart1.Series.Add("GC");
    Chart1.Series.Add("OFPC");
    Chart1.Series.Add("ROCIP");

    var cat = (IList<Deficiencies>) ((StateResults) ViewData["StateResults"]).CategoryDeficiencies;
    Chart1.ChartAreas["ChartArea1"].AxisX.IntervalAutoMode = IntervalAutoMode.FixedCount;
    Chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;
    
    
    
    
    for (var i = 0; i < cat.Count; i++ )
    {


        Chart1.Series["GC"].Points.AddY(cat[i].GC);
       
        Chart1.Series["GC"].IsValueShownAsLabel = false;

        Chart1.Series["OFPC"].Points.AddY(cat[i].OFPC);
        Chart1.Series["OFPC"].Points[i].AxisLabel = cat[i].Category;
        Chart1.Series["OFPC"].Points[i].LabelAngle = 30;
        
        
        Chart1.Series["OFPC"].IsValueShownAsLabel = false;
        
        Chart1.Series["ROCIP"].Points.AddY(cat[i].ROCIP);
        Chart1.Series["ROCIP"].IsValueShownAsLabel = false;
    }
    
      
    Chart1.BorderSkin.SkinStyle = BorderSkinStyle.None;
    Chart1.BorderWidth = 0;
    
    Chart1.Legends.Add("Legend1");
    
        // show legend based on check box value
    Chart1.Legends["Legend1"].Enabled = true;

    // Render chart control
    Chart1.Page = this;
    var writer = new HtmlTextWriter(Page.Response.Output);
    Chart1.RenderControl(writer);

 %>
 <h4>General Work Activity Defecient Condition Categories</h4>
    <table cellpadding="5" cellspacing="5" style="border-collapse:collapse" border="1">
        <tr>
            <td>General Work Activity Defecient Condition Categories</td>
            <td>ROCIP Team</td>
            <td>OFPC Team</td>
            <td>ROCIP Team</td>
        </tr>
    <%
        foreach (var c in ((StateResults)ViewData["StateResults"]).GeneralDeficiencies)
        {%>
        <tr>
            <td><%=c.Category %></td>
            <td><%=c.GC %>%</td>
            <td><%=c.OFPC %>%</td>
            <td><%=c.ROCIP %>%</td>
        </tr>
           
        <%}%>
        
    </table>
    <br />
    <% var Chart2 = new System.Web.UI.DataVisualization.Charting.Chart
                      {
                          Width = 750,
                          Height = 296,
                          RenderType = RenderType.ImageTag,
                          ImageLocation = "..\\..\\TempImages\\ChartPic_#SEQ(200,30)",
                          Palette = ChartColorPalette.BrightPastel
                      };

   t = new Title("Statewide Severity Levels", Docking.Top, new System.Drawing.Font("Trebuchet MS", 9, System.Drawing.FontStyle.Bold), System.Drawing.Color.FromArgb(26, 59, 105));
   Chart2.Titles.Add(t);
   Chart2.ChartAreas.Add("ChartArea1");

    // Enable X axis labels automatic fitting
   Chart2.ChartAreas["ChartArea1"].AxisX.IsLabelAutoFit = true;
   Chart2.ChartAreas["ChartArea1"].AxisX.TextOrientation = TextOrientation.Rotated90;
    // Set X axis automatic fitting style
   Chart2.ChartAreas["ChartArea1"].AxisX.LabelAutoFitStyle =
        LabelAutoFitStyles.DecreaseFont | LabelAutoFitStyles.IncreaseFont | LabelAutoFitStyles.WordWrap;
    // create a couple of series
   Chart2.Series.Add("GC");
   Chart2.Series.Add("OFPC");
   Chart2.Series.Add("ROCIP");

    
    Chart2.ChartAreas["ChartArea1"].AxisX.IntervalAutoMode = IntervalAutoMode.FixedCount;
    Chart2.ChartAreas["ChartArea1"].AxisX.Interval = 1;
    
    
    
    
    
    Chart2.Series["GC"].Points.AddY(((StateResults) ViewData["StateResults"]).GCSeverityA);
    Chart2.Series["GC"].IsValueShownAsLabel = false;

    Chart2.Series["OFPC"].Points.AddY(((StateResults)ViewData["StateResults"]).OFPCSeverityA);
    Chart2.Series["OFPC"].Points[0].AxisLabel = "A";
    Chart2.Series["OFPC"].IsValueShownAsLabel = false;

    Chart2.Series["ROCIP"].Points.AddY(((StateResults)ViewData["StateResults"]).ROCIPSeverityA);
    Chart2.Series["ROCIP"].IsValueShownAsLabel = false;

    Chart2.Series["GC"].Points.AddY(((StateResults)ViewData["StateResults"]).GCSeverityB);
    Chart2.Series["GC"].IsValueShownAsLabel = false;

    Chart2.Series["OFPC"].Points.AddY(((StateResults)ViewData["StateResults"]).OFPCSeverityB);
    Chart2.Series["OFPC"].Points[1].AxisLabel = "B";
    Chart2.Series["OFPC"].IsValueShownAsLabel = false;

    Chart2.Series["ROCIP"].Points.AddY(((StateResults)ViewData["StateResults"]).ROCIPSeverityB);
    Chart2.Series["ROCIP"].IsValueShownAsLabel = false;

    Chart2.Series["GC"].Points.AddY(((StateResults)ViewData["StateResults"]).GCSeverityC);
    Chart2.Series["GC"].IsValueShownAsLabel = false;

    Chart2.Series["OFPC"].Points.AddY(((StateResults)ViewData["StateResults"]).OFPCSeverityC);
    Chart2.Series["OFPC"].Points[2].AxisLabel = "C";
    Chart2.Series["OFPC"].IsValueShownAsLabel = false;

    Chart2.Series["ROCIP"].Points.AddY(((StateResults)ViewData["StateResults"]).ROCIPSeverityC);
    Chart2.Series["ROCIP"].IsValueShownAsLabel = false;


    Chart2.Series["GC"].Points.AddY(((StateResults)ViewData["StateResults"]).GCSeverityD);
    Chart2.Series["GC"].IsValueShownAsLabel = false;

    Chart2.Series["OFPC"].Points.AddY(((StateResults)ViewData["StateResults"]).OFPCSeverityD);
    Chart2.Series["OFPC"].Points[3].AxisLabel = "D";
    Chart2.Series["OFPC"].IsValueShownAsLabel = false;

    Chart2.Series["ROCIP"].Points.AddY(((StateResults)ViewData["StateResults"]).ROCIPSeverityD);
    Chart2.Series["ROCIP"].IsValueShownAsLabel = false;

    Chart2.BorderSkin.SkinStyle = BorderSkinStyle.None;
    Chart2.BorderWidth = 0;

    Chart2.Legends.Add("Legend1");
    
        // show legend based on check box value
    Chart2.Legends["Legend1"].Enabled = true;

    // Render chart control
    Chart2.Page = this;
    writer = new HtmlTextWriter(Page.Response.Output);
    Chart2.RenderControl(writer);

 %>
 <h4>Statewide Claims Reported</h4>
    <table cellpadding="5" cellspacing="5" style="border-collapse:collapse" border="1">
        <tr>
            <td>#</td>
            <td>Coverage</td>
            <td>Date Of Loss</td>
            <td>Accident Narrative</td>
            <td>Site</td>
            <td>Project #</td>
            <td>Nature of Injury</td>
            
            
            
        </tr>
    <%
        var claims = ((StateResults) ViewData["StateResults"]).Claims;
        for (var i = 0; i < claims.Count; i++)
        {%>
        <tr>
            <td><%=i %></td>
            <td><%=claims[i].Coverage%></td>
            <td><%=claims[i].DateofLoss.ToShortDateString()%></td>
            <td><%=claims[i].AccidentNarrative%></td>
            <td><%=claims[i].SiteLevel1Name%></td>
            <td><%=claims[i].SiteLevel1%></td>
            <td><%=claims[i].NCCINatureofInjury%></td>
            
            
        </tr>
           
        <%}%>
        
    </table>
    <br />
 <% 
     var Chart3 = new System.Web.UI.DataVisualization.Charting.Chart
     {
         Width = 750,
         Height = 296,
         RenderType = RenderType.ImageTag,
         ImageLocation = "..\\..\\TempImages\\ChartPic_#SEQ(200,30)",
         Palette = ChartColorPalette.BrightPastel
     };
     Chart3.ChartAreas.Add("Area");
     Chart3.Series.Add("Series");
     Chart3.Series["Series"].ChartType = SeriesChartType.Pie;
     Chart3.Series["Series"]["PieLabelStyle"] = "Inside";
     Chart3.Series["Series"].Label = "#VALY";
     Chart3.Series["Series"].LegendText = "#VALX";

     // Display a Title
     Chart3.Titles.Add("Statewide Injury Types");

     // Add Data to Display

     Chart3.Series["Series"].Points.DataBindXY(((StateResults)ViewData["StateResults"]).Injuries.Keys, ((StateResults)ViewData["StateResults"]).Injuries.Values);

     // Call Out The Letter "D"
     

     // Display a Legend
     Chart3.Legends.Add(new Legend("Injuries"));
     Chart3.Legends["Injuries"].Title = "Injuries";
    
     Chart3.Series["Series"].Legend = "Injuries";
     Chart3.Page = this;
     writer = new HtmlTextWriter(Page.Response.Output);
     Chart3.RenderControl(writer);
 %>
</asp:Content>
